package com.yunxin.core.infra.persistence.mapper.channel;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.yunxin.core.infra.persistence.entity.channel.ChannelPromotionDO;
import com.yunxin.core.infra.persistence.entity.channel.query.condition.ChannelPromotionPageCondition;
import com.yunxin.core.infra.persistence.entity.channel.query.result.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * @author zero°
 * @since 2023-05-25
 */
@DS("core")
@Mapper
public interface ChannelPromotionExtendMapper extends ChannelPromotionMapper {

    /**
     * 根据推广code查询渠道id
     * @param promotionCode promotionCode
     * @return id
     */
    Long getChannelIdByPromotionCode(@Param("promotionCode") String promotionCode);

    /**
     * 根据推广code查询渠道页面code
     * @param promotionCode promotionCode
     * @return id
     */
    String getChannelPageInfoByPromotionCode(@Param("promotionCode") String promotionCode);

    /**
     * 根据推广code查询渠道推广详情(C端)
     * @param promotionCode promotionCode
     * @return ChannelPromotionDetailsResult
     */
    ChannelPromotionDetailsResult getChannelPromotionDetailsResultByPromotionCode(@Param("promotionCode") String promotionCode);

    /**
     * 根据推广code查询渠道推广信息
     * @param promotionCode promotionCode
     * @return ChannelPromotionInfoResult
     */
    ChannelPromotionInfoResult getChannelPromotionInfoByPromotionCode(@Param("promotionCode") String promotionCode);

    /**
     * 根据推广code查询渠道推广价格信息
     * @param promotionCode promotionCode
     * @return ChannelPromotionInfoPriceResult
     */
    ChannelPromotionPriceInfoResult getChannelPromotionPriceInfoByPromotionCode(@Param("promotionCode") String promotionCode);

    /**
     * 根据推广codes查询渠道推广信息
     * @param promotionCodes promotionCodes
     * @return  List<ChannelPromotionInfoResult>
     */
    List<ChannelPromotionInfoResult> listChannelPromotionInfoByPromotionCodes(@Param("promotionCodes") Set<String> promotionCodes);

    /**
     * 根据推广name模糊查询渠道推广信息
     * @param promotionName promotionName
     * @return  List<ChannelPromotionInfoResult>
     */
    List<ChannelPromotionInfoResult> listChannelPromotionInfoByPromotionName(@Param("promotionName") String promotionName);

    /**
     * 根据渠道推广id查询渠道推广基础信息
     * @param promotionId promotionId
     * @return ChannelPromotionCustomConfig
     */
    ChannelPromotionBasicInfoResult selectByPromotionId(@Param("promotionId") Long promotionId);

    /**
     * 分页查询渠道推广列表总条数
     * @param condition condition
     * @return int
     */
    long countChannelPromotionPageQuery(ChannelPromotionPageCondition condition);

    /**
     * 分页查询渠道推广列表
     * @param condition condition
     * @return List<ChannelPromotionPageResult>
     */
    List<ChannelPromotionPageResult> channelPromotionPageQuery(ChannelPromotionPageCondition condition);

    /**
     * 根据渠道推广id查询渠道推广保存结果
     * @param promotionId promotionId
     * @return ChannelPromotionSaveResult
     */
    ChannelPromotionSaveResult getChannelPromotionSaveResult(@Param("promotionId") Long promotionId);

    /**
     * 根据渠道id查询渠道推广code
     * @param channelId channelId
     * @return List<String>
     */
    List<String> listPromotionCodeByChannelId(@Param("channelId") Long channelId);


    /**
     * 根据推广code查询渠道推广信息
     * @param promotionCode promotionCode
     * @return ChannelPromotionDO
     */
    ChannelPromotionDO selectByPromotionCode(@Param("promotionCode") String promotionCode);

    /**
     * 根据渠道推广code获取渠道logo
     * @param promotionCode promotionCode
     * @return String
     */
    String selectChannelLogoByPromotionCode(@Param("promotionCode") String promotionCode);
}
